package com.hdax.dm.scheduler.controller;

import com.hdax.dm.scheduler.dto.ChooseSeatScheduleDto;
import com.hdax.dm.scheduler.dto.SeatDto;
import com.hdax.dm.scheduler.service.SchedulerSeatService;
import com.hdax.dm.utils.CommonResponse;
import com.hdax.dm.utils.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping(path = "/scheduler")
public class SchedulerSeatController {

    @Autowired
    private SchedulerSeatService seatService;

    @PostMapping(path = "choose/seat/getSeatList")
    public CommonResponse<SeatDto> getSeats(@RequestBody Map<String,Long> params){
        Long scheduleId = params.get("scheduleId");
        return seatService.getSeats(scheduleId);
    }

    /**
     * 查询排期的详情
     * @param params
     * @return
     */
    @PostMapping(path = "choose/seat/getSchedule")
    public CommonResponse<ChooseSeatScheduleDto> chooSeat(@RequestBody Map<String,Long> params){
        Long scheduleId = params.get("scheduleId");
        return seatService.seatAvaliable(scheduleId);
    }
}
